package com.quanquan.parking.ketop.controller.statisticsReport;

import com.quanquan.parking.ketop.service.statisticsReport.KetopParkingReportService;
import com.quanquan.parking.request.PayNotifyRequest;
import enums.ResCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import web.response.ResultBody;

import java.io.Serializable;
import java.util.Map;

/**
 * 功能描述:优惠券统计报表
 *
 * @ClassName: CouponReportController
 * @Author: xiongjunbao
 * @Date: 2019-05-30 10:31
 * @Version: V1.0
 */
@RestController
@RequestMapping("/ketop_parking_num")
public class KetopParkingReportController implements Serializable {
    private final KetopParkingReportService parkingReportService;

    @Autowired
    public KetopParkingReportController(KetopParkingReportService parkingReportService) {
        this.parkingReportService = parkingReportService;
    }


    /**
     * 停车数量统计 分日、周、月、年
     *
     * @return
     */
    @PostMapping("/parking_num")
    public ResultBody parkingNum(@RequestBody PayNotifyRequest request) {
        //获取当前时间
        Map<String, Object> map = parkingReportService.parkingNum(request);
        if (map.isEmpty()){
            return new ResultBody(ResCodeEnum.NO_DATA.getCode(), "暂无数据");
        }
        return new ResultBody(ResCodeEnum.SUCCESS.getCode(), "SUCCESS",map);
    }

    /**
     * 停车费统计 分日、周、月、年
     *
     * @return
     */
    @PostMapping("/parking_fee_num")
    public ResultBody parkingFeeNum(@RequestBody PayNotifyRequest request) {
        //获取当前时间
        Map<String, Object> map = parkingReportService.parkingFeeNum(request);
        if (map.isEmpty()){
            return new ResultBody(ResCodeEnum.NO_DATA.getCode(), "暂无数据");
        }
        return new ResultBody(ResCodeEnum.SUCCESS.getCode(), "SUCCESS",map);
    }


}
